home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1995 April / Internet Tools.iso / mail / listserv / utils / mmdfcatmail.c.patch.Z / mmdfcatmail.c.patch
Encoding:
Internet Message Format  |  1993-10-18  |  3.6 KB

  1. From markd@grizzly.com Sat Oct  9 01:41:05 1993
  2. Return-Path: <markd@grizzly.com>
  3. Received: from cats-po-1.UCSC.EDU by cs-mail.bu.edu (5.61+++/Spike-2.1)
  4.     id AA23414; Sat, 9 Oct 93 01:40:54 -0400
  5. Received: from scruz.UCSC.EDU by cats.ucsc.edu with SMTP
  6.     id AA19004; Fri, 8 Oct 93 22:40:53 -0700
  7. Received: from osprey by scruz.ucsc.edu id aa06254; 8 Oct 93 22:31 PDT
  8. To: tasos@cs.bu.edu
  9. Cc: unix-listproc@stormking.com
  10. Subject: util/mmdfcatmail.c patch
  11. Date: Fri, 8 Oct 93 22:17:08 PDT
  12. From: Mark Diekhans <markd@grizzly.com>
  13. Message-Id:  <9310082217.aa21335@osprey.grizzly.com>
  14. Status: RO
  15.  
  16.  
  17. Enclosed is a patch to the util/mmdfcatmail.c program.  Due to the behavior of
  18. extract_address, it would fail if a From: hreader did not contain a comment!
  19. Someone mailed me about this recently, before I found the problem, but I have
  20. lost their mail.
  21.  
  22. Mark
  23.  
  24.  
  25. *** util/mmdfcatmail.c.org    Fri Oct  8 22:09:35 1993
  26. --- util/mmdfcatmail.c    Fri Oct  8 22:09:54 1993
  27. ***************
  28. *** 169,179 ****
  29.           argv [0] = CATMAIL;
  30.       execv (CATMAIL, argv);
  31.       
  32. !     fprintf (stderr, "exec of %s failed: %s", CATMAIL, strerror (errno));
  33.       exit (1);
  34.   }
  35.   
  36.   /*
  37.    * Do actual work of copying stdin catmail process, filling in the missing
  38.    * "From address Date" line.
  39.    */
  40. --- 169,190 ----
  41.           argv [0] = CATMAIL;
  42.       execv (CATMAIL, argv);
  43.       
  44. !     fprintf (stderr, "exec of %s failed: %s\n", CATMAIL, strerror (errno));
  45.       exit (1);
  46.   }
  47.   
  48.   /*
  49. +  * Extract address even if it has leading spaces.  The standard extract
  50. +  * address only works with leading spaces if there are <> or () in the
  51. +  * address.
  52. +  */
  53. + ExtractAddress (char *addr)
  54. + {
  55. +     cleanup_request (addr);
  56. +     extract_address (addr);
  57. + }
  58. + /*
  59.    * Do actual work of copying stdin catmail process, filling in the missing
  60.    * "From address Date" line.
  61.    */
  62. ***************
  63. *** 203,226 ****
  64.        * Search for the minimum headers we need and save away lines for later
  65.        * output.
  66.        */
  67. !     while (! ((fromAddress [0] != '\0') && (date [0] != '\0'))) {
  68.           if (fgets (line, MAX_LINE, stdin) == NULL)
  69.               break;
  70.   
  71.           SaveLine (line, &headerList);
  72.   
  73.           if (strncmp (line, "From:", 5) == 0) {
  74.               strcpy (fromAddress, line + 5); 
  75. !             extract_address (fromAddress);
  76.               continue;
  77.           }
  78. !         if (strncmp (line, "Sender:", 6) == 0) {
  79.               strcpy (fromAddress, line + 6); 
  80. !             extract_address (fromAddress);
  81.               continue;
  82.           }
  83.           if (strncmp (line, "Date:", 5) == 0) {
  84.               strcpy (date, line + 6); 
  85.               continue;
  86.           }
  87.           linesRead++;
  88. --- 214,246 ----
  89.        * Search for the minimum headers we need and save away lines for later
  90.        * output.
  91.        */
  92. !     while (TRUE) {
  93.           if (fgets (line, MAX_LINE, stdin) == NULL)
  94.               break;
  95.   
  96.           SaveLine (line, &headerList);
  97.   
  98. +         /*
  99. +          * Remove leading spaces, terminate loop if its a blank line.
  100. +          */
  101. +         cleanup_request (line);
  102. +         if (line [0] == '\0')
  103. +             break;
  104.           if (strncmp (line, "From:", 5) == 0) {
  105.               strcpy (fromAddress, line + 5); 
  106. !             ExtractAddress (fromAddress);
  107.               continue;
  108.           }
  109. !         if ((strncmp (line, "Sender:", 6) == 0) &&
  110. !             (fromAddress [0] == '\0')) {
  111.               strcpy (fromAddress, line + 6); 
  112. !             ExtractAddress (fromAddress);
  113.               continue;
  114.           }
  115.           if (strncmp (line, "Date:", 5) == 0) {
  116.               strcpy (date, line + 6); 
  117. +             cleanup_request (date);
  118.               continue;
  119.           }
  120.           linesRead++;
  121.  
  122.